var server = { };
installFunction(server, 'addDept', 'post');
installFunction(server, 'getDept', 'get')

var addDept = function() {
	var arg = new Array();
	$('#dept input[type="text"]').each(function(index){
		arg.push($(this).val());
	});
	
	server.addDept(arg, addDeptSuccess);
}
var addDeptSuccess = function(response) {
	alert(response);
}

var getDept = function(id) {
	server.getDept(id, getDeptSuccess);
}
var getDeptSuccess = function(dept) {
	var contentString = '<br /><h3>' + dept.name + '</h3><p>' + dept.address + '</p><p><a target="_blank" href="' + dept.link + '">Website</a></p>';
	if (!info) {
		info = new google.maps.InfoWindow({
			content: contentString
		});
	}
	else {
		info.setContent(contentString);
	}
	info.open(map, marker);
	google.maps.event.addListener(info, 'closeclick', function(){
		marker.setMap(null);
		delete info	
    });
}